#ifndef VPGAMEBASE_H
#define VPGAMEBASE_H

#include "vpconn.h"

class GameDBInterface;


//***********************************************************************************************
// kharmon.  03-22-06.  #10515.
// 
// This class serves as a common interface so that the VPConnection class can deal with all
// types of Game objects through the same interface.
// 
//***********************************************************************************************
class VPGameBase
{
public:

    virtual ~VPGameBase() { };

    // called to create Game object instances.
    static VPGameBase * createGame(VPConnection *pConn, GameDBInterface *pDBInterface);

    // used to check to see that game objects are in a valid state
    virtual bool8 initOk() = 0;

    // lets games examine incoming messages to see if the game should process them.
    virtual bool8 handleMessage(unsigned char *pucMsgBuf, int32 nMsgLen) = 0;

    // Called by the connection object when it wants the game object to send it's entire 
    // current state down to the client.  Typically only used when restoring a saved game.
    virtual void send() = 0;

    // returns the current paytable for this game.
	virtual int32 getPayFreq() = 0;

    // returns whether the "double up" option is enabled for this game
	virtual bool8 getDoubleUpEnabled() = 0;	

    // returns the currently sidebet paytable for this game
    virtual uint8 getSideBetPayTable() { return (uint8) getPayFreq(); }

    // returns whether the side bet option is enabled for the current game 
    // (if side bets are even supported)
    virtual bool8 getSideBetEnabled()  { return false;        }

    // possible results when trying to create a new game instance.
    enum NewGameResult { NG_OK, NG_NOMONEY, NG_FAILED };

    // possible states the game can be in after processing the 
    // user's double-up selection
    enum DUDrawResults
	{
		DUDRAW_SUCCESS_GAMEOVER,
		DUDRAW_SUCCESS_DBLUP_PENDING,
		DUDRAW_FAILURE
	};

    // possible results when processing a game's initial "Deal" message.
	enum DealResults
	{
		DEAL_SUCCESS,
		DEAL_INVALID_BET,
		DEAL_NOT_ENOUGH_MONEY,
		DEAL_CREATE_GAME_FAILURE,
        DEAL_PROGRESSIVE_FAILURE
	};

    // A game object must be in at least one of these states at all times.
    enum GameStates
    {
	    VPGS_NOTSTARTED		= 0,
	    VPGS_GAMESTARTED	= 1,
	    VPGS_DBLUPPENDING	= 2,
	    VPGS_DBLUPSTARTED	= 4,
	    VPGS_GAMEOVER		= 8
    };

    // Possible results for a round of "double up"
    enum VPDoubleUpResults
    {
        VPEVT_DBLUP_LOSER   = 0xff,
        VPEVT_DBLUP_WON     = 0xfe,
        VPEVT_DBLUP_TIE     = 0xfd
    };

};



#endif